model(Mean = MEAN(y), Naive = NAIVE(y), SNaive = SNAIVE(y), Drift = RW(y ~ drift())) fits all four simultaneously.
gg_tsresiduals(fit) plots residuals, ACF, and histogram in one call.augment(fit) |> features(.innov, ljung_box, lag = 10).
filter(year(date) <= 2019) creates the training set; filter(year(date) > 2019) creates the test set.| Measure | Formula | Interpretation |
|---|---|---|
| MAE | mean(|et|) | Average absolute miss; same units as the series. |
| RMSE | √mean(et²) | Penalizes large errors more; same units as series. |
| MAPE | mean(|et/yt|) × 100 | Scale-free %; undefined when yt = 0. |
| MASE | MAE / MAEnaïve | Scaled by naïve benchmark; < 1 means better than naïve. |
stretch_tsibble(.init = 48, .step = 1) creates the rolling origins; then model() |> forecast(h = 12) |> accuracy() aggregates the errors.
forecast(fit, bootstrap = TRUE, times = 1000).accuracy(forecasts, test_data, measures = list(CRPS = CRPS)).model(m1 = ..., m2 = ..., m3 = ...) |> mutate(combo = (m1 + m2 + m3) / 3).model() — fit one or more models to a tsibble.forecast(h = ...) — generate point forecasts and prediction intervals.accuracy() — compute error measures on test data.autoplot() — visualize forecasts with shaded prediction intervals.